<template>
	<div>
		<!--编排模板选择-->
		<baseSelect 
			ref="baseSelect"
			:defaultValue="defaultValue" 
			:optionList="options" 
			:filterable="true"
			placeholder="请选择"
			@change="changeHandel"></baseSelect>
	</div>
</template>

<script>
	import baseSelect from "@/view/components/select/select";
	import {getOrchestrateInfo} from "@/service/swagger/OrchestrateController"
	
	export default {
		components : {
			baseSelect
		},
		props:[
			"defaultValue"
		],
		data(){
			return {
				options: [],
			}
		},
		mounted(){
			this.getData();
		},
		methods : {
			changeHandel(name , v, selectedArr){
				this.$emit("change", "bianpaiMobanSelect", v , selectedArr)
			},
			
			getData(){
				getOrchestrateInfo({
					
				}).then(ret=>{
					let arr = ret.data.map(el=>{
						return {
							label : el.name ,
							value : el.serviceTemplateId ,
							sourceData : el,
						}
					})
					arr.unshift({
						label : "全部" ,
						value : "",
					})
					this.options = arr ;
					this.$refs.baseSelect.asyncUpdateOption(this.options)
				})
			},
			
			reset(){
				this.$refs.baseSelect.reset()
			}
		}
	}
</script>

<style>
</style>